package io.renren.sf.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.sf.entity.CbChapterPictureEntity;
import io.renren.sf.service.CbChapterPictureService;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author cyl_txw
 * @email cyl_txw@gmail.com
 * @date 2021-03-31 13:04:11
 */
@RestController
@RequestMapping("sf/cbchapterpicture")
public class CbChapterPictureController {
    @Autowired
    private CbChapterPictureService cbChapterPictureService;

    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    //@RequiresPermissions("sf:cbchapterpicture:info")
    public R info(@PathVariable("id") Long id){
		CbChapterPictureEntity cbChapterPicture = cbChapterPictureService.getById(id);

        return R.ok().put("cbChapterPicture", cbChapterPicture);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    //@RequiresPermissions("sf:cbchapterpicture:save")
    public R save(@RequestBody CbChapterPictureEntity cbChapterPicture){
		cbChapterPictureService.save(cbChapterPicture);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    //@RequiresPermissions("sf:cbchapterpicture:update")
    public R update(@RequestBody CbChapterPictureEntity cbChapterPicture){
		cbChapterPictureService.updateById(cbChapterPicture);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    //@RequiresPermissions("sf:cbchapterpicture:delete")
    public R delete(@RequestBody Long[] ids){
		cbChapterPictureService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
